<template>
  <div>
    <h2>getter练习</h2>
    <p>{{fruit}}</p>
    <p>{{getAge}}</p>
    <button @click="change">changeFruit</button>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  computed: {
    fruit() {
      return this.$store.getters.getterFruit;
    },
    ...mapGetters([
      'getAge'
    ])
  },
  methods: {
    change() {
      this.$store.commit("changeFruit", {fruit: "pear"})
    }
  }
}
</script>

<style>

</style>